<!DOCTYPE html>
<html>

<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>回调地狱</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <link rel='stylesheet' type='text/css' media='screen' href='main.css'>
    <script src='main.js'></script>
</head>

<body>

</body>
<script>
    //回调地狱，当回调函数互相嵌套，嵌套层数过多，导致代码维护性变差，这种结构就是我们常说的回调地狱
    //以前发送请求的时候，通过ajax去实现
    function ajax(url, sucesscb, errorcb) {
        setTimeout(() => {
            sucesscb('123')
        }, 1000)
    }
    ajax('/aaa', (data) => {
        ajax('/bbb', (data) => {
            ajax('/ccc', (data) => {

            }, () => { })
        }, () => { })
    }, () => { })
</script>

</html>